﻿using BBCore.Application.ViewModels.Admins;
using BBCore.Core.Models.Admins;
using BBCore.Core.Models.EnumTypes;
using BBCore.Core.Models.Samples;
using BootstrapBlazor.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BBCore.Application.Admins
{
    /// <summary>
    /// 管理员全数据服务
    /// </summary>
    public interface IAdminService
    {
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="loginVo">登录界面</param>
        /// <returns>用户登录信息,包括RoleId</returns>
        Task<UserEntity> user_LoginAsync(LoginVo loginVo);
        /// <summary>
        /// 根据用户名得到用户登录信息
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <returns></returns>
        UserEntity user_Login(string userName);
        /// <summary>
        /// 根据用户名得到用户登录信息
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <returns></returns>
        Task<UserEntity> user_LoginAsync(string userName);
        /// <summary>
        /// 根据角色Id得到角色信息,包括下挂的菜单
        /// </summary>
        /// <param name="roldId">角色Id</param>
        /// <returns></returns>
        RoleEntity role_Role(int roldId);
        /// <summary>
        /// 得到Role表的roleId和roleName，类似于组织id和组织名称
        /// </summary>
        /// <param name="isEmpty">首行是否包含空的一行</param>
        /// <returns></returns>
        IEnumerable<SelectedItem> role_SelectedItems(bool isEmpty);

        /// <summary>
        /// 根据菜单id得到菜单表的单条信息,不包括ControlDetails的信息
        /// </summary>
        /// <param name="menuid">菜单id</param>
        /// <returns></returns>
        MenuEntity menu_Getmenu(int menuid);
        /// <summary>
        /// 根据菜单id得到菜单表的单条信息,包括Include  ControlDetails的信息
        /// </summary>
        /// <param name="menuid">菜单id</param>
        /// <returns></returns>
        MenuEntity menu_GetmenuIncludeMany(int menuid);

        /// <summary>
        /// 递归得出左侧导航菜单树形数据结构
        /// </summary>
        /// <param name="menuEntities">用户菜单</param>
        /// <param name="parentId">父ID,以0开始</param>
        /// <returns></returns>
        List<MenuItem> menu_CascadingMenu(List<MenuEntity> menuEntities, int parentId);
        /// <summary>
        /// 递归得出用户菜单树形数据结构
        /// </summary>
        /// <param name="menuEntities">用户菜单</param>
        /// <param name="parentId">父ID,以0开始</param>
        /// <returns></returns>
        List<TreeViewItem<int>> menu_TreeCascadingMenu(List<MenuEntity> menuEntities, int parentId);
        /// <summary>
        /// 所有菜单信息List集合数据
        /// </summary>
        /// <returns></returns>
        Task<List<MenuEntity>> menu_MenuEntityListAsync();
        /// <summary>
        /// // 构造树状数据结构
        /// </summary>
        /// <param name="items">IEnumerable<MenuEntity>对象</param>
        /// <returns></returns>
        Task<IEnumerable<TableTreeNode<MenuEntity>>> TreeNodeConverter(IEnumerable<MenuEntity> items);
        /// <summary>
        ///根据用户名,菜单URL,Crud按钮枚举验证按钮是否显示
        /// </summary>
        /// <param name="username">用户名</param>
        /// <param name="url">菜单URL</param>
        /// <param name="typeEnum">"Add,Edit,Del等等"</param>
        /// <returns>存在为true，没有则为false</returns>
        bool AuthorizingBlock(string username,string url,string typeEnum);
    

    }
}
